﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data.OleDb;
using System.Data;
using System.Windows.Controls;

namespace QLInternet.Model
{
    class TableModel
    {
        public static OleDbDataAdapter adapter;
        public static DataSet dataset;
        public OleDbCommand command;

        public DataSet tableData(DataSet dataset, MySqlConnection connection, string query)
        {
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            adapter.SelectCommand = new MySqlCommand(query, connection);
            adapter.Fill(dataset);
            return dataset;
        }
        public void tableModel(String query, DataGrid dataGrid, MySqlConnection connection )
        {
            dataset = new DataSet();
            dataset = tableData(dataset, connection, query);
            dataGrid.DataContext = dataset;
        }

    }
}
